package com.zc.controller.zjb;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author 赵家宝
 */
@RestController
@RequestMapping("/zjb")
public class ZjbController {

   @Autowired
   ZjbService zjbService;
    /**
     * 测试
     * @return hello
     */
    @RequestMapping("/queryAll")
    public List<Student> test(String username){
        System.out.println(username);
        List<Student> stus=zjbService.queryAll();
       // Student student=new Student(30,"王杰",22,"男");
        //zjbService.add(student);
        //zjbService.update(student);
        zjbService.delete(30);
        return stus;
    }
    @RequestMapping("/add")
    public void add(Student student){
        zjbService.add(student);
    }
    @RequestMapping("/update")
    public void update(Student student){
        zjbService.update(student);
    }
    @RequestMapping("/del/{id}")
    public void delete(@PathVariable(value = "id")Integer id){
        zjbService.delete(id);
    }
}
